import {
	defineConfig
} from 'vite'
import vue from '@vitejs/plugin-vue'

var baseUrl;

switch (process.env.NODE_ENV) {
	case 'dev':
		baseUrl = 'http://www.netss.cn'
		break;
	case 'build':
		baseUrl = 'http://www.netss.cn'
		break;
	case 'prod':
		baseUrl = 'http://www.netss.cn'
		break;
	default:
		baseUrl = 'http://www.netss.cn';
		break;
}
// https://vitejs.dev/config/

const path = require('path');

export default defineConfig({
	plugins: [vue()],
	define: {
		'process.env': {}
	},
	publicPath: './',
	server: {
		proxy: {
			'/api': {
				/*target: baseUrl,*/
				target: 'http://admin.v2netss.cn/v1/',
				changeOrigin: true,
				secure: false,
				rewrite: (path) => path.replace(/^\/api/, '')
			}
		},
		https: true, // https:{type:Boolean}
		disableHostCheck: true,
		open: true, //配置自动启动浏览器

	},

	devServer: {
		https: {
			cert: 'D:/project/gouziyuan-admin_html/src/cert/certificate.pem',
			key: 'D:/project/gouziyuan-admin_html/src/cert/privatekey.pem',
		}
	}
})